<?php 
/*
Plugin Name: Seta partner
*/
class Seta_partner_Widget extends WP_Widget{

  public function __construct() {
        parent::__construct(false,$name = __('Seta Partner'));
  }
  public function widget( $args,$instanse ){

    if(isset($instanse['show_post_widget_title'])){
        $widget_title = $instanse['show_post_widget_title'];
    }

    if(isset($instanse['show_post_widget_cat_value'])){
        $cat_id = $instanse['show_post_widget_cat_value'];
    }

    if(isset($instanse['num_post'])){
        $num_post = $instanse['num_post'];
    }
?>
<!-- output html -->
<div id="partners" class="region with-lead text-center bg-highlighted animated-area">
  <div class="container">
    <h2 class="title-big">Các đối tác tiêu biểu</h2>
    <p class="lead">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sit amet diam eu erat vehicula feugiat. Duis varius diam id congue dignissim</p>
    <div class="row">
      <a href="javascript:void(0)"class="animated" data-animation="fadeInLeft"><img src="http://localhost/seta-asia/wp-content/themes/setatheme/images/customer-1.png" alt="customer-1" /></a>
      <a href="javascript:void(0)"class="animated" data-animation="fadeInLeft"><img src="http://localhost/seta-asia/wp-content/themes/setatheme/images/customer-2.png" alt="customer-2" /></a>
      <a href="javascript:void(0)"class="animated" data-animation="fadeInDown"><img src="http://localhost/seta-asia/wp-content/themes/setatheme/images/customer-3.png" alt="customer-3" /></a>
      <a href="javascript:void(0)"class="animated" data-animation="fadeInRight"><img src="http://localhost/seta-asia/wp-content/themes/setatheme/images/customer-4.png" alt="customer-4" /></a>
      <a href="javascript:void(0)"class="animated" data-animation="fadeInRight"><img src="http://localhost/seta-asia/wp-content/themes/setatheme/images/customer-5.png" alt="customer-5" /></a>
    </div>
  </div>
</div>
<?php 
  }
  public function form( $instanse ){

    $instance = wp_parse_args( (array) $instance, $defaults );

    if(isset($instanse['show_post_widget_cat_value'])){
        $show_post_widget_cat_value = $instanse['show_post_widget_cat_value'];
    }
    
    if(isset($instanse['show_post_widget_title'])){
        $show_post_widget_title = $instanse['show_post_widget_title'];
    }
    
    if(isset($instanse['num_post'])){
        $num_post = $instanse['num_post'];
    }
?>
<!-- Widget form -->
<p>Title:<input type="text" name="<?php echo $this->get_field_name('show_post_widget_title'); ?>" value="<?php echo $show_post_widget_title; ?> " /></p>
<?php    
  }
  public function update($new_instance,$old_instance){
    $instance = $old_instance;
      
    $instance['show_post_widget_cat_value'] = (!empty($new_instance['show_post_widget_cat_value'])) ? 
    strip_tags($new_instance['show_post_widget_cat_value']) : '';
    
    $instance['show_post_widget_title'] = (!empty($new_instance['show_post_widget_title'])) ? 
    strip_tags($new_instance['show_post_widget_title']) : '';
    
    $instance['num_post'] = (!empty($new_instance['num_post'])) ? 
    strip_tags($new_instance['num_post']) : '';
    
    return $instance;
  }
}
add_action('widgets_init',function(){register_widget('Seta_partner_Widget');});